package com.beiing.tianshuai.tianshuai.mine.presenter;

import com.beiing.tianshuai.tianshuai.base.BasePresenter;
import com.beiing.tianshuai.tianshuai.mine.model.CompanyIdentificationModel;
import com.beiing.tianshuai.tianshuai.mine.model.CompanyIdentificationModelImpl;
import com.beiing.tianshuai.tianshuai.mine.view.CompanyIdentificationViewImpl;

import java.io.File;
import java.util.List;

import okhttp3.ResponseBody;

/**
 * Created by Jinni on 2017/8/22 0022.
 */

public class CompanyIdentificationPresenter extends BasePresenter implements
        CompanyIdentificationPresenterImpl, CompanyIdentificationModel.OnRequestListener{

    private CompanyIdentificationModelImpl mModel;
    private CompanyIdentificationViewImpl mView;

    public CompanyIdentificationPresenter(CompanyIdentificationViewImpl view) {
        mModel = new CompanyIdentificationModel(this);
        mView = view;
    }

    @Override
    public void getSubmitIdentificationResult(String uid, String name, String title, String tel, List<File> images) {
        mView.showProgress();
        mModel.getSubmitIdentificationResult(uid, name, title, tel, images);
    }

    @Override
    public void onSuccess(ResponseBody bean) {
        mView.hideProgress();
        mView.onRequestSuccess(bean);
    }

    @Override
    public void onError(Throwable throwable) {
        mView.hideProgress();
        mView.onRequestFailed(throwable);
    }
}
